#include <functional>
#include <iostream>
#include <numeric>
struct cumsum_add1 {
  int operator()(int a, int b) { return a + b + 1; }
} cumsum_obj;
int main() {
  int a[] = {1, 3, 5, 7, 9, 10};
  int *result = new int[6];
  std::partial_sum(a, a + 6, result);             // 1 4 9 16 25 35
  std::partial_sum(a, a + 6, result, cumsum_obj); // 1 5 11 19 29 40
  for (int i = 0; i < 6; i++)
    std::cout << result[i] << " ";
  delete[] result;
}
